#include<stdio.h>
#include<string.h>
int cmp_int_arr(const void*p1,const void*p2) {
	return *((int*)p1) - *((int*)p2);
}
struct stu {
	int age;
	char name[20];
	int weight;
};
int cmp_char_by_name(const void* p1, const void* p2) {
	return strcmp(((struct stu*)p1)->name, ((struct stu*)p2)->name);
}
int main()
{
	int arr1[] = { 1,5,6,5,8,8,8,1,2,2,5,4 };
	int sz1 = sizeof(arr1) / sizeof(arr1[0]);
	qsort(arr1, sz1, sizeof(arr1[0]), cmp_int_arr);
	for (int i = 0; i < sz1;i++) {
		printf("%d ", arr1[i]);
	}
	printf("\n");
	struct stu arr2[] = { {18,"huishen",56},{19,"jibo",58},{14,"yyy",51} };
	int sz2 = sizeof(arr2) / sizeof(arr2[0]);
	qsort(arr2, sz2, sizeof(arr2[0]), cmp_char_by_name);
	for (int i = 0; i < sz2; i++) {
		printf("%s ", arr2[i].name);
	}
	return 0;
}